<%--
 *  File:    ComboCodeSegSummary.jsp
 *  @Author: Hilldao
 *  Date:    2002/1/8
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.OvalLabel" %>
<%@ page import="com.oval.util.OvalCustomColumn" %>
<%@ page import="com.oval.util.OvalCustomMessage" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.ComboCodeSegSummary");
  String strTableName = "ovcombocodesegment";
  String strModuleName = "SPM";
  String privilegeCode = "Z0607,Z0614";
%>



<%

  //get userinfo
  HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
  String strfieldid = request.getParameter("fieldid");
  boolean reload = false;
  if(session.getAttribute("fieldidsession")!=null)
  {
    strfieldid = session.getAttribute("fieldidsession").toString();
    reload = true;
  }
  if(strfieldid==null)
  {
    strfieldid = "";
  }
%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="combocodesegsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js">
</script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>
<%if(reload){%>
  parent.down.location.href = "ComboCodeSegSummary.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&fieldid=<%=JspHelper.filterNull(strfieldid)%>"
<%}%>
var remote;
function closeChild()
{
  if(remote!=null)
     remote.close()
  page_summary('first');
}

function clickComboCodeSeg(id,value,seid)
{
  <%--[SCRIPT]  alert("id->"+id);  [SCRIPT]--%>
  <%--[SCRIPT]  alert("valuesource->"+value);  [SCRIPT]--%>
  document.combocodesegform.segmentid.value = id;
  document.combocodesegform.valuesource.value = value;
  document.combocodesegform.sequenceid.value = seid;
}
function page_delete()
{
	  var id = document.combocodesegform.segmentid.value;
	  if(id == null || id.length == 0 || id == "" || id == "-1")
	    return;
	  var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
	  if(!flag)
	    return;
	  document.combocodesegform.actionname.value = "delete";
	  document.combocodesegform.target = "_self";
	  isRunning = true;
	  document.combocodesegform.submit();
}
function page_add()
{
  var id = document.combocodesegform.fieldid.value;
  if(id == null || id.length == 0 || id == "" || id == "-1")
	    return;
  var link = "ComboCodeSegEdit.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&fieldid="+id;
  <%--[SCRIPT]  alert(link);  [SCRIPT]--%>
  remote = window.open(link, "newwindow", "height=140, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no")
}
function page_edit()
{
  var id = document.combocodesegform.segmentid.value;
	if(id == null || id.length == 0 || id == "" || id == "-1")
	   return;

  var link = "ComboCodeSegEdit.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&isfirst=true&segmentid="+id + "&fieldid="+document.combocodesegform.fieldid.value;
  <%--[SCRIPT]  alert(link);  [SCRIPT]--%>
  remote = window.open(link, "newwindow", "height=120, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no")
}
function page_valueList()
{
  if(document.combocodesegform.valuesource.value != 2)
     return;

  var id = document.combocodesegform.segmentid.value;
	if(id == null || id.length == 0 || id == "" || id == "-1")
	   return;
  var link = "ComboCodeSegValueSummary.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&segmentid="+id;
  <%--[SCRIPT]  alert(link);  [SCRIPT]--%>
	remote = window.open(link, "newwindow", "height=240, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no")
}
function page_seq()
{
  if(document.combocodesegform.valuesource.value != 3)
     return;
  var id = document.combocodesegform.segmentid.value;
	if(id == null || id.length == 0 || id == "" || id == "-1")
	   return;
  var link = "ComboCodeSegSeqEdit.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&segmentid="+id+"&sequenceid=" + document.combocodesegform.sequenceid.value;
  <%--[SCRIPT]  alert(link);  [SCRIPT]--%>
	remote = window.open(link, "newwindow", "height=120, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no")
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(combocodesegform,actionvalue,orderbyname);
  editform.action = "ComboCodeSegSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
</script>
<%
  OvalCustomTable table = new OvalCustomTable(strLanguageCode);
  OvalCustomColumn column = new OvalCustomColumn(strLanguageCode);
  cat.debug("The strCurSearchName is :" + strCurSearchName);
  cat.debug("The strCurSearchValue is :" + strCurSearchValue);
  cat.debug("The strCurOrderByCol is :" + strCurOrderByCol);
  cat.debug("The strCurOrderByType is :" + strCurOrderByType);
  cat.debug("The nCurMaxItem is :" + nCurMaxItem);
  cat.debug("The nCurCount is :" + nCurCount);
  cat.debug("The nCurPageNo is :" + nCurPageNo);
  cat.debug("The nCurTotalPage is :" + nCurTotalPage);
  cat.debug("The nCurEndIndex is :" + nCurEndIndex);
  cat.debug("The bCurHasPre is :" + bCurHasPre);
  cat.debug("The bCurHasNext is :" + bCurHasNext);
  cat.debug("The CurUserInfo is :" + CurUserInfo);

  Vector ComboCodeSegSummary = (Vector)pageContext.getAttribute("allcombocodesegs");

  if(ComboCodeSegSummary == null||reload)
  {
    ComboCodeSegSummary = new Vector();
  }
  cat.debug("The ComboCodeSegSummary is :" + ComboCodeSegSummary);
%>

</head>
<body>
<table width="100%" cellspacing="0">
  <tr>
    <td class="summary_top"></td>
  </tr>
  <tr>
    <td><img src="../../images/<%= strLanguageCode %>/quote.gif" width="16" height="11"> <%= label.getLabelName("L_SegmentSet") %><%= label.getLabelName("L_Colon") %></td>
  </tr>
</table>

<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="combocodesegform" method="post" action="../../Dispatcher"  target="_parent">
   <input type="hidden" name="pagename" value="combocodesegsummary">
	 <input type="hidden" name="actionname">
	 <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

	 <input type="hidden" name="fieldid" value="<%=JspHelper.filterNull( strfieldid )%>">
	 <tr>
    <td>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left" >
          <td width="22" class="deepblue-left">&nbsp;</td>
          <td width="30" class="title_center" nowrap>&nbsp;<a href="javascript:page_summary('orderby','segmentno')"><%= label.getLabelName("L_Sequence") %></a></td>
          <td width="50" class="title_center">&nbsp;<a href="javascript:page_summary('orderby','segmentwidth')"><%= label.getLabelName("L_Length") %></a></td>
          <td class="title_center">&nbsp;<a href="javascript:page_summary('orderby','segmentdesc')"><%= label.getLabelName("L_Description") %></a></td>
          <td class="title_center">&nbsp;<a href="javascript:page_summary('orderby','valuesource')"><%= label.getLabelName("L_ValueSource") %></a></td>
          <td class="title_center">&nbsp;<a href="javascript:page_summary('orderby','tablename')"><%= label.getLabelName("L_TableName") %></a></td>
          <td class="title_center">&nbsp;<a href="javascript:page_summary('orderby','fieldname')"><%= label.getLabelName("L_Field") %></a></td>
          <td class="title_center" width="90">&nbsp;<a href="javascript:page_summary('orderby','funcname')"><%= label.getLabelName("L_FunctionName") %></a></td>
        </tr>


        <%
             int j = 0;
             String strClassType = new String();
             Integer nDefaultId = new Integer(-1);
             Integer nDefaultvaluesource = new Integer(-1);
             Integer nDefaultSequeceId = new Integer(-1);
             boolean bHasChecked = false;
          %>
          <logic:iterate id="ComboCodeSeg" collection="<%= ComboCodeSegSummary %>">
         <%
            HashMap ComboCodeSegMap = (HashMap)pageContext.getAttribute("ComboCodeSeg");

            String strIsDisabled = new String("");
            String strIsChecked = new String("");

            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }
           if(!bHasChecked)
            {
              strIsChecked = "Checked";
              bHasChecked = true;
              nDefaultId = (Integer)(ComboCodeSegMap.get("segmentid"));
              nDefaultvaluesource = (Integer)(ComboCodeSegMap.get("valuesource"));
              nDefaultSequeceId = (Integer)(ComboCodeSegMap.get("sequenceid"));
            }
            j++;
          %>

           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:radiotrue('exchangrate<%=JspHelper.filterNull(j)%>');clickComboCodeSeg('<%=JspHelper.filterNull( ComboCodeSegMap.get("segmentid") )%>','<%=JspHelper.filterNull( ComboCodeSegMap.get("valuesource") )%>','<%=JspHelper.filterNull( ComboCodeSegMap.get("sequenceid") )%>')" class="<%=JspHelper.filterNull(strClassType)%>">
            <td width="5%">
              <input id="exchangrate<%=JspHelper.filterNull(j)%>" type="radio" name="checkdept"  value='<%=JspHelper.filterNull( ComboCodeSegMap.get("segmentid") )%>' class="checkbox" <%=JspHelper.filterNull( strIsChecked)%> onClick="javascript:clickComboCodeSeg('<%=JspHelper.filterNull( ComboCodeSegMap.get("segmentid") )%>','<%=JspHelper.filterNull( ComboCodeSegMap.get("valuesource") )%>','<%=JspHelper.filterNull( ComboCodeSegMap.get("sequenceid") )%>')">
            </td>
            <td>&nbsp;<%=JspHelper.filterNull( ComboCodeSegMap.get("segmentno") )%></a></td>
            <td>&nbsp;<%=JspHelper.filterNull( ComboCodeSegMap.get("segmentwidth") )%></td>
            <td>&nbsp;<%=JspHelper.filterNull( ComboCodeSegMap.get("segmentdesc") )%></td>
            <td>&nbsp;<%=JspHelper.filterNull( ComboCodeSegMap.get("valuesourcename") )%></td>
            <%if(ComboCodeSegMap.get("tablename")!=null&&!((String)ComboCodeSegMap.get("tablename")).equals("null")){%>
              <td>&nbsp;<%=JspHelper.filterNull( table.getTable((String)ComboCodeSegMap.get("tablename")) )%></td>
            <%}else{%>
              <td>&nbsp;</td>
            <%}%>

            <%if(ComboCodeSegMap.get("fieldname")!=null&&!((String)ComboCodeSegMap.get("fieldname")).equals("null")){%>
              <td>&nbsp;<%=JspHelper.filterNull( column.getColumnDesc((String)ComboCodeSegMap.get("tablename"),(String)ComboCodeSegMap.get("fieldname")) )%></td>
            <%}else{%>
              <td>&nbsp;</td>
            <%}%>
              <td>&nbsp;<%=JspHelper.filterNull( ComboCodeSegMap.get("funcname") )%></td>
          </tr>
          </logic:iterate>
          <input type="hidden" name="segmentid" value="<%=JspHelper.filterNull( nDefaultId )%>">
          <input type="hidden" name="valuesource" value="<%=JspHelper.filterNull( nDefaultvaluesource )%>">
          <input type="hidden" name="sequenceid" value="<%=JspHelper.filterNull( nDefaultSequeceId )%>">

    <% //--------------------------------------  flipping page --%>
    <%@ include file="/inc/SummaryAction.inc" %>


      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td class="summary_top"></td>
        </tr>
        <tr>
          <td class="td_center">
          <a onclick="page_add()"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>
          <a onclick="page_edit()"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60"/></a>
          <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
          <a onclick="page_valueList()"><custom:button type="1" label="L_ValueList" imgsrc="ValueList.gif" border="0" style="width:60"/></a>
          <a onclick="page_seq()"><custom:button type="1" label="L_Listnumber" imgsrc="Listnumber.gif" border="0" style="width:60"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </form>
</table>
</body>
</html>


